package io.renren.dao;

import io.renren.common.dao.BaseDao;
import io.renren.dto.CollarmxDTO;
import io.renren.entity.CollarmxEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 辅材领用明细表
 *
 * @author 罗胜平 781757616@qq.com
 * @since 1.0.0 2019-11-22
 */
@Mapper
public interface CollarmxDao extends BaseDao<CollarmxEntity> {
    //主订单号查询
    @Select("SELECT * from  canteens_collarmx cx ,canteens_food cf where cx.food_id = cf.food_id and cx.collar_id = '${collarId}' GROUP BY cx.food_id ")
    List<CollarmxDTO> seleCollarmx(Long collarId);

    @Select("DELETE  from canteens_collarmx  where collar_id = '${order}'  " )
    void deleteOrder( Long order);
    @Select("UPDATE  canteens_collarmx set total_price = '${totalPrice}' where collarmx_id = '${order}'  " )
    void updateOrder( Long order,Float totalPrice);
    @Select("UPDATE canteens_collarmx set collar_num = '${purchaseNum}' where collar_id =${orderId}  and food_id = ${foodId} ")
    void updateOrder2(long orderId,long foodId,float purchaseNum);
    @Select("DELETE from canteens_collarmx where collar_id =${orderId}  and food_id = ${foodId} ")
    void delectOrder(long orderId,long foodId);
    @Select(" select * from canteens_collarmx where collar_id =${orderId}  and food_id = ${foodId} ")
    CollarmxDTO getOrder(long orderId,long foodId);
}